#pragma once

#ifndef POINTER_64
#define POINTER_64
#endif //POINTER_64

#include <iostream>
#include <sstream>
#include <fstream>
#include <stdio.h>

#include "Types.h"

#include "global_defs.h"

namespace PRO
{
	class CLog
	{
	public:
		static CLog& instance();
		static CLog& endl();
		static std::string time();

		void begin();
		void clear();

		CLog& operator<<(const CLog& data);

		CLog& operator<<(const int8_t& data);
		CLog& operator<<(const int16_t& data);
		CLog& operator<<(const int32_t& data);
		CLog& operator<<(const uint8_t& data);
		CLog& operator<<(const uint16_t& data);
		CLog& operator<<(const uint32_t& data);
		CLog& operator<<(const string_t& data);
		CLog& operator<<(const float& data);

	private:
		CLog();
		~CLog();

		bool opened_;
		std::ofstream log_file_;
	};
};

#define LOG_BEGIN PRO::CLog::instance().begin()
#define LOG_CLEAR PRO::CLog::instance().clear()

#define LOG_CLEAR_BEGIN LOG_CLEAR; LOG_BEGIN;

#define LOG(msg) PRO::CLog::instance() << PRO::CLog::time() << msg << PRO::CLog::endl()
#define LOG_ERROR(header, msg) PRO::CLog::instance() << "*** ERROR: " << header << ": " << msg << PRO::CLog::endl()